/**
 *  项目详情窗口，可以更改
 */
Ext.ns('Ext.projectaudit');

Ext.projectaudit.Window = Ext.extend(Ext.Window,{
	modal:true,
	cloasable : true,
	autoScroll: true,
	height: 170,
	width: 400,
	buttonAlign: 'center',
	layout : 'fit',
	initComponent : function(){
		this.auditPanel = new Ext.form.FormPanel({
			layout:'form',
//			height : 500,
			width : 500,
//			autoScroll: false,
			autoHeight: true,
			items:[{
				xtype : 'textfield',
				fieldLabel : '项目实际成果ID',
				id : this.id+'actualResultsId',
				readOnly: true
			},{
				xtype:'textfield',
				fieldLabel : '项目编号',
				id : this.id+'projectNumber',
				readOnly: true
			},{
				xtype:'textfield',
				fieldLabel : '项目名称',
				id:this.id+'projectName',
				readOnly: true
			}]
		});
		
		this.items = this.auditPanel;
		Ext.unit.Window.superclass.initComponent.call(this);
}
})


function project_audit(actualresultsid,projectnumber,projectname)
	{
	var a  = Ext.getCmp("mc_project_audit");
	if(a == null ){
		a= new Ext.projectaudit.Window({
			autoScroll: true,
			id : "mc_project_audit",
			closable : true,
			title : "项目审核",
			buttons : [{
				xtype:'button',
				text:'审核通过',
				handler : function(b,e){
					var a = b.findParentBy(function(ct, cmp) { 
						return (ct instanceof Ext.projectaudit.Window) ? true : false; 
					});
					var c = a.auditPanel;

					
						
					c.form.submit({
						url:'midCheck/midCheckAction!adminCheck',
						method: 'post',
						success : function(form,action){
							Ext.Msg.alert('提示','项目已审核！');
							Ext.getCmp('projectlist').getStore().reload();
							//更新成功之后刷新store
							var n = Ext.getCmp('mc_projectaudit');
							if(n != null)
								n.grid.store.load({
									params:{
          	        	 				start:0,
          	        	 				limit: 30
								}
								});
					},
						failure : function(form,action){
							Ext.Msg.alert('提示','更新项目信息失败！');
					},
						params : {
						actualresultsid: c.findById(a.id+'actualResultsId').getValue()
						         }
					});
					a.close();
			}
			},'-',{
				xtype:'button',
				text:'取消',
				handler : function(b,e){
					var a = b.findParentBy(function(ct, cmp) { 
						return (ct instanceof Ext.projectaudit.Window) ? true : false; 
					});
					a.close();
			}
			}]
		});
	}
	
	a.auditPanel.findById(a.id+'actualResultsId').setValue(actualresultsid);
	a.auditPanel.findById(a.id+'projectNumber').setValue(projectnumber);
	a.auditPanel.findById(a.id+'projectName').setValue(projectname);
	//打开窗口
	a.show();
}